<template lang="pug">
    view(class="cu-item flex-sub" scope="{activedId}" @tap="onTap"
        :class="id==activedId?'text-orange cur':''")  
            slot {{ name }}
</template>
<script>
export default {
  name: "nav-item",

  inject: ["rootNav"],

  props: {
    name: { type: String }, // 标题

    id: { type: String } // 唯一Id
  },

  computed: {
    activedId() {
      return this.rootNav.activedId;
    }
  },

  methods: {
    onTap() {
      this.rootNav.changeActived(this.id);
    }
  }
};
</script>
<style scoped lang="less">
</style>